<!--
 * @Descripttion:
 * @version:
 * @Author: hhy
 * @Date: 2021-03-18 14:33:25
 * @LastEditors: hhy
 * @LastEditTime: 2021-05-17 17:32:54
 * @FilePath: \votemp-user-pc\src\layout\lpoll\components\msg.vue
-->
<template>
  <div class="tip-msg">
    <div class="img-box">
      <img v-if="$store.state.msgSuccess" src="@/assets/ok_msg.png" alt="msg" />
      <img v-else src="@/assets/error_msg.png" alt="msg" />
    </div>

    <p class="tip c9 f16" :class="{ f14: !$store.state.msgSuccess }">
      {{ $store.state.msgText }}
    </p>
    <i class="el-icon-close cursor" @click="onClose" />
  </div>
</template>

<script>
import { defineComponent } from "vue";
import store from "@/store";
import { baseMsg } from "@/utils/utils";
export default defineComponent({
  name: "TipMsg",
  mounted() {
    setTimeout(() => {
      baseMsg("");
    }, 1200);
  },
  methods: {
    onClose() {
      store.commit("commitSave", {
        key: "msgText",
        data: "",
      });
    },
  },
});
</script>

<style lang="scss" scoped>
.tip-msg {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 99999;
  transform: translate(-50%, -50%);
  width: 248px;
  padding: 20px 0 0 0;
  border-radius: 4px;
  // border: 1px solid #ececec;
  background-color: rgba(255, 255, 255, 1);
  border: 1px solid rgba(230, 230, 230, 1);
  color: #666;
  // 操作提示框加个投影吧，颜色：#000000 透明度：20%，投影大小：x轴0  y2 大小8，溢出0
  box-shadow: 0 0 8px 0 rgba($color: #000000, $alpha: 0.1);
  text-align: center;
  img {
    width: 58px;
    padding-top: 20px;
  }
  .tip {
    line-height: 20px;
    padding: 20px 20px 20px 25px;
  }
  .f14 {
    font-size: 14px !important;
  }
  img {
    width: 51px;
  }
  .el-icon-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px;
  }
}
</style>
